//
//  MeSignatureV.m
//  ZITHER
//
//  Created by weixin on 2018/9/26.
//  Copyright © 2018年 weixn. All rights reserved.
//

#import "MeSignatureV.h"
#import <UMCommon/UMCommon.h>

@implementation MeSignatureV

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUI];
    }
    return self;
}



-(void)setUI{
    
    [self addSubview:self.labSign];
    [self addSubview:self.labContant];
    [self addSubview:self.labVes];
    [self addSubview:self.signBtn];
    [self addSubview:self.image];
    
    [self.image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(0);
        make.centerX.equalTo(self).offset(0);
        make.height.mas_equalTo(49);
        make.width.mas_equalTo(43);
    }];

    [self.labSign mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(0);
        make.centerX.equalTo(self).offset(0);
    }];
    
    [self.labContant mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.image.mas_bottom).offset(10);
        make.centerX.equalTo(self).offset(0);
    }];
    
    [self.labVes mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.labContant.mas_bottom).offset(4);
        make.centerX.equalTo(self).offset(0);
    }];
    
    [self.signBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.labVes.mas_top).offset(-2);
        make.left.equalTo(self.labVes.mas_right).offset(0);
        make.height.mas_equalTo(12);
        make.width.mas_equalTo(30);

    }];
    
}

-(void)isLogin:(BOOL)type{
    self.signBtn.hidden = type;
}

- (UILabel *)labSign{
    if (!_labSign) {
        _labSign = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labSign.text = RootProjectName;
        _labSign.font = [UIFont fontWithName:@"Helvetica-Bold" size:12];
        _labSign.hidden = YES;
    }
    return _labSign;
}

- (UILabel *)labContant{
    if (!_labContant) {
        _labContant = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labContant.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
        _labContant.textColor = [UIColor colorWithHex:@"333333"];
        _labContant.text = @"全国专业的腕表社区";
    }
    return _labContant;
}

- (UILabel *)labVes{
    if (!_labVes) {
        _labVes = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _labVes.font = [UIFont fontWithName:@"Arial-BoldMT" size:12];
        _labVes.textColor = [UIColor colorWithHex:@"333333"];
        _labVes.text = @"1.0.0";
//        _labVersions.text = @"V3.0.15";
    }
    return _labVes;
}

- (QMUIButton *)signBtn{
    if (!_signBtn) {
        _signBtn = [[QMUIButton alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        [_signBtn setCornerRadiusWithRadius:6 isMasks:YES];
        [_signBtn setTitle:@" " forState:UIControlStateNormal];
        [_signBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _signBtn.backgroundColor = [UIColor colorWithHex:@"FF6F6F"];
        _signBtn.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:10];

        _signBtn.hidden = YES;
//        @weakify(self);
        [[_signBtn rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
//            @strongify(self);

        }];
    }
    return _signBtn;
}

-(BaseImageV *)image{
    if (!_image) {
        _image = [[BaseImageV alloc]initializeFrame:CGRectMake(0, 0, 53, 20) contentMode:1];
        _image.image = [UIImage imageNamed:@"文字logo"];
        
        [[_image addTag]subscribeNext:^(id  _Nullable x) {
            
//            NSString* deviceID =  [UMConfigure deviceIDForIntegration];
//
//            [[serviceDefualt loadReportCategoryuPushUuid:deviceID ReponseObjctClass:nil]subscribeNext:^(ResponseData * x) {
//                if (x.success) {
//                    [Tools showTips:@"提交测试设备成功"];
//                }else{
//                    [Tools showTips:x.errorInfo];
//                }
//            }];
        }];
    }
    return _image;
}

@end
